package nc.ui.so.m32.billui.handler;

import nc.ui.pub.bill.BillCardPanel;
import nc.ui.pubapp.uif2app.event.IAppEventHandler;
import nc.ui.pubapp.uif2app.event.card.CardHeadTailAfterEditEvent;
import nc.ui.so.m32.billui.util.CardPanelUtil;
import nc.ui.so.pub.keyvalue.CardKeyValue;
import nc.vo.so.pub.keyvalue.IKeyValue;

public class SaleInvoiceCardHeadExtAfterHandler implements IAppEventHandler<CardHeadTailAfterEditEvent>{

	@Override
	public void handleAppEvent(CardHeadTailAfterEditEvent event) {
		BillCardPanel cardPanel = event.getBillCardPanel();
		IKeyValue keyValue = new CardKeyValue(cardPanel);
		if("vdef47".equals(event.getKey()) || "corigcurrencyid".equals(event.getKey())) {
			int rowCount = cardPanel.getBillModel().getRowCount();
			int[] rows = new int[rowCount];
			Object[] values = new Object[rowCount];
			for(int i = 0; i < rowCount; i ++) {
				rows[i] = i;
				values[i] = keyValue.getBodyValue(i, "vbdef13");
			}
			CardPanelUtil.execCalculate_kk(cardPanel, rows, "vbdef13", values);
		}
	}

}
